package com.ruoyi.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.domain.Equipmentdistribution;
import com.ruoyi.service.IEquipmentdistributionService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * EquipmentdistributionController
 * 
 * @author wjy
 * @date 2025-01-11
 */
@RestController
@RequestMapping("/equipmentdistribution")
public class EquipmentdistributionController extends BaseController
{
    @Autowired
    private IEquipmentdistributionService equipmentdistributionService;

    /**
     * 查询Equipmentdistribution列表
     */
    @RequiresPermissions("equipmentdistribution:equipmentdistribution:list")
    @GetMapping("/list")
    public TableDataInfo list(Equipmentdistribution equipmentdistribution)
    {
        startPage();
        List<Equipmentdistribution> list = equipmentdistributionService.selectEquipmentdistributionList(equipmentdistribution);
        return getDataTable(list);
    }

    /**
     * 导出Equipmentdistribution列表
     */
    @RequiresPermissions("equipmentdistribution:equipmentdistribution:export")
    @Log(title = "Equipmentdistribution", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Equipmentdistribution equipmentdistribution)
    {
        List<Equipmentdistribution> list = equipmentdistributionService.selectEquipmentdistributionList(equipmentdistribution);
        ExcelUtil<Equipmentdistribution> util = new ExcelUtil<Equipmentdistribution>(Equipmentdistribution.class);
        util.exportExcel(response, list, "Equipmentdistribution数据");
    }

    /**
     * 获取Equipmentdistribution详细信息
     */
    @RequiresPermissions("equipmentdistribution:equipmentdistribution:query")
    @GetMapping(value = "/{distributionId}")
    public AjaxResult getInfo(@PathVariable("distributionId") Long distributionId)
    {
        return success(equipmentdistributionService.selectEquipmentdistributionByDistributionId(distributionId));
    }

    /**
     * 新增Equipmentdistribution
     */
    @RequiresPermissions("equipmentdistribution:equipmentdistribution:add")
    @Log(title = "Equipmentdistribution", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Equipmentdistribution equipmentdistribution)
    {
        return toAjax(equipmentdistributionService.insertEquipmentdistribution(equipmentdistribution));
    }

    /**
     * 修改Equipmentdistribution
     */
    @RequiresPermissions("equipmentdistribution:equipmentdistribution:edit")
    @Log(title = "Equipmentdistribution", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Equipmentdistribution equipmentdistribution)
    {
        return toAjax(equipmentdistributionService.updateEquipmentdistribution(equipmentdistribution));
    }

    /**
     * 删除Equipmentdistribution
     */
    @RequiresPermissions("equipmentdistribution:equipmentdistribution:remove")
    @Log(title = "Equipmentdistribution", businessType = BusinessType.DELETE)
	@DeleteMapping("/{distributionIds}")
    public AjaxResult remove(@PathVariable Long[] distributionIds)
    {
        return toAjax(equipmentdistributionService.deleteEquipmentdistributionByDistributionIds(distributionIds));
    }
}
